using System;

namespace SharpMud.Scripting.Metadata
{
	/// <summary>
	/// Marks an object as being the host for either one or multiple script implementations.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class)]
	[CLSCompliant(false)]
	public class ScriptHostObjectAttribute : System.Attribute
	{
		#region Private Variables
		private System.Guid						_Guid;
		private bool							_RequiresInstanciation;
		private ScriptObjectScriptMultiplicity	_ScriptMultiplicity;
		#endregion

		#region Constructors
		/// <summary>
		/// The default constructor for ScriptHostObjectAttribute
		/// </summary>
		private ScriptHostObjectAttribute()
		{
		}

		/// <summary>
		/// Marks an object as being the host for either one or multiple script implementations.
		/// </summary>
		/// <param name="guid">If marking a single script object, this is the Guid for that script. If marking
		/// a multi-script object, this is the Guid for the group of scripts.</param>
		/// <param name="requiresInstanciation">Whether or not the target object must</param>
		/// <param name="scriptMultiplicity">The...multiplicity...of scripts...in the object</param>
		public ScriptHostObjectAttribute(System.Guid guid, bool requiresInstanciation, ScriptObjectScriptMultiplicity scriptMultiplicity)
		{
			this._Guid = guid;
			this._RequiresInstanciation = requiresInstanciation;
			this._ScriptMultiplicity = scriptMultiplicity;
		}
		#endregion

		#region Public Properties
		/// <summary>
		/// If marking a single script object, this is the Guid for that script. If marking
		/// a multi-script object, this is the Guid for the group of scripts.
		/// </summary>
		public System.Guid Guid
		{
			get
			{
				return _Guid;
			}
		}

		/// <summary>
		/// Whether or not the object represents multiple scripts or not
		/// </summary>
		public bool HasMultipleScripts
		{
			get
			{
				return (this._ScriptMultiplicity==ScriptObjectScriptMultiplicity.MultiScriptObject);
			}
		}

		/// <summary>
		/// Whether or not the object type must be instanciated in order to access the scripts
		/// </summary>
		public bool RequiresInstanciation
		{
			get
			{
				return _RequiresInstanciation;
			}
		}
		#endregion
	}

	/// <summary>
	/// The multiplicity for a script object
	/// </summary>
	public enum ScriptObjectScriptMultiplicity
	{
		/// <summary>
		/// Represents a single-script object
		/// </summary>
		SingleScriptObject,
		/// <summary>
		/// Represents a multi-script object
		/// </summary>
		MultiScriptObject
	}
}
